# %%
from zhipuai import ZhipuAI
client = ZhipuAI(api_key="") # 请填写您自己的APIKey
# %%

with open("02_taxable_income_in.txt", "r", encoding="utf-8") as f:
    in_02 = f.read()

# %%
prompts = []
prompts.append(in_02)
prompts.append("请帮我介绍一下这段文字的含义")
prompts.append("如果是已婚家庭夫妻联合申报个人所得税，该如何计算其taxable income")
prompts.append("根据这段文字描述给出一个python函数用于计算这种情况下的美国个人所得税")
prompts.append("目前我已经了解了法律条款26 USC 1和26 USC 63，如果想继续了解关于个人所得税计算相关的法律原文，还可以在哪些章节查找？")

contents = []
messages = []
messages.append({"role": "system", "content": "美国税制专家"})

for prompt in prompts:
    contents.append(prompt)
    messages.append({"role": "user", "content": prompt})
    response = client.chat.completions.create(
        model="GLM-4-Flash-250414",  # 填写需要调用的模型编码
        messages = messages,
    )
    content = response.choices[0].message.content
    messages.append({"role": "assistant", "content": content})
    contents.append(content)

with open("02_out.txt", "w", encoding="utf-8") as f:
    f.write("\n".join(contents))

# %%
